package xin.nick.roc.consumer.client;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Nick
 * @date 2021/7/4
 * @description
 */
@Data
public class ProviderInfo {
    private static List<ProviderInfo> providerInfoList = new ArrayList<>();
    private static AtomicInteger atomicInteger = new AtomicInteger();

    private String ip;
    private int port;

    public static ProviderInfo getProviderInfo() {
        return providerInfoList.get(Math.abs(atomicInteger.incrementAndGet() % providerInfoList.size()));
    }
    public List<ProviderInfo>  getProviderList() {
        return providerInfoList;
    }
}
